package smetana.modules.ui.actions;

import com.google.inject.Inject;
import org.apache.pivot.wtk.Dialog;
import org.apache.pivot.wtk.DialogCloseListener;
import smetana.modules.io.ExcelImportService;
import smetana.modules.ui.form.io.ImportPriceListPanel;
import smetana.modules.ui.model.UIModel;

/**
 *
 * @author dmitry.mamonov
 */
public class ImportPriceListAction extends AbstractAction {
    @Inject
    ExcelImportService excelImportService;

    @Inject
    ImportPriceListPanel importPriceListPanel;

    @Inject
    UIModel uiModel;

    @Override
    public void perform() {
        final Dialog dialog = new Dialog();
        dialog.setPreferredWidth((int) (uiModel.getWindow().getWidth() * 0.9));
        dialog.setPreferredHeight((int) (uiModel.getWindow().getHeight() * 0.9));
        dialog.setContent(importPriceListPanel.getComponent());
        dialog.open(uiModel.getWindow(), new DialogCloseListener() {
            @Override
            public void dialogClosed(Dialog dialog, boolean modal) {
                dialog.setContent(null);
            }
        });
    }
}
